package com.hust360.percent.pojo;

import java.io.Serializable;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

/**
 * 打折信息的实体类
 */
public class DiscountInfo implements Comparable<DiscountInfo>, Serializable{
	
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 5797192080236519923L;

	/**
	 * Comparator的排序对比接口
	 * 可以通过实现不同的该接口实现不同的排序方法
	 */
	private static Comparator<DiscountInfo> comparator;
	
	public static final String TABLE_NAME = "DiscountInfo";

	/**
	 * 打折信息的id
	 */
	private Long discountInfoId;

	public static final String DISCOUNT_INFO_ID_COLUMN = "discountInfoId";

	/**
	 * 打折信息对应的店铺的id
	 */
	Long shopId;

	public static final String SHOP_ID_COLUMN = "shopId";

	/**
	 * 打折信息对应的区域的id
	 */
	private Long areaId;

	public static final String AREA_ID_COLUMN = "areaId";

	/**
	 * 打折信息的文本描述
	 */
	String discountInfo;
	public static final String DISCOUNT_INFO_COLUMN = "discountInfo";

	/**
	 * 打折类别 （1 全场 0 部分)
	 */
	private Integer discountType;

	public static final String DISCOUNT_TYPE_COLUMN = "discountType";

	/**
	 * 折扣比例 (0 到 10）折
	 */
	private Integer discount;

	public static final String DISCOUNT_COLUMN = "discount";

	/**
	 * 打折的图片的名称的集合
	 */
	List<String> discountImage;
	public static final String DISCOUNT_IMAGE_COLUMN = "discountImage";

	/**
	 * 点击喜欢的人数
	 */
	Long liked;

	public static final String LIKED_COLUMN = "liked";

	/**
	 * 类别 0 全部 1： 购物 2：美食 3：酒店 4:电影 5：电子电器 6：娱乐休闲
	 * 
	 */
	private Integer type;

	public static final String TYPE_COLUMN = "type";

	/**
	 * 打折开始的时间
	 */
	private Date beginDate;

	public static final String BEGIN_DATE_COLUMN = "beginDate";

	/**
	 * 打折结束的时间
	 */
	private Date endDate;

	public static final String END_DATE_COLUMN = "endDate";

	/**
	 * 加入系统的时间
	 */
	private Date createDate;
	public static final String CREATE_DATE_COLUMN = "createDate";
	
	/**
	 * 改变量不存如数据库。仅在读出经纬度之后，算出距离，并赋值
	 */
	private double distance = 0;

	public static final String[] COLUMNS = { DISCOUNT_INFO_ID_COLUMN,
			AREA_ID_COLUMN, SHOP_ID_COLUMN, DISCOUNT_INFO_COLUMN,
			DISCOUNT_TYPE_COLUMN, DISCOUNT_COLUMN, DISCOUNT_IMAGE_COLUMN,
			LIKED_COLUMN, BEGIN_DATE_COLUMN, END_DATE_COLUMN,TYPE_COLUMN,
			CREATE_DATE_COLUMN };

	public DiscountInfo() {
		liked = null;
		shopId = null;
		discountInfoId = null;
		type = null;
	}

	public Long getShopId() {
		return shopId;
	}

	public void setShopId(Long shopId) {
		this.shopId = shopId;
	}

	public List<String> getDiscountImage() {
		return discountImage;
	}

	public void setDiscountImage(List<String> discountImage) {
		this.discountImage = discountImage;
	}

	public String getDiscountInfo() {
		return discountInfo;
	}

	public void setDiscountInfo(String discountInfo) {
		this.discountInfo = discountInfo;
	}

	public Long getAreaId() {
		return areaId;
	}

	public void setAreaId(Long areaId) {
		this.areaId = areaId;
	}

	public Integer getDiscount() {
		return discount;
	}

	public void setDiscount(Integer discount) {
		this.discount = discount;
	}

	public Date getBeginDate() {
		return beginDate;
	}

	public void setBeginDate(Date beginDate) {
		this.beginDate = beginDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Long getLiked() {
		return liked;
	}

	public void setLiked(Long liked) {
		this.liked = liked;
	}

	public Long getDiscountInfoId() {
		return discountInfoId;
	}

	public void setDiscountInfoId(Long discountInfoId) {
		this.discountInfoId = discountInfoId;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Integer getDiscountType() {
		return discountType;
	}

	public void setDiscountType(Integer discountType) {
		this.discountType = discountType;
	}

	@Override
	public int compareTo(DiscountInfo another) {
		if (getComparator() != null) {
			return getComparator().compare(this, another);
		}
		return 0;
	}

	public static Comparator<DiscountInfo> getComparator() {
		return DiscountInfo.comparator;
	}

	public static void setComparator(Comparator<DiscountInfo> comparator) {
		DiscountInfo.comparator = comparator;
	}

	public double getDistance() {
		return distance;
	}

	public void setDistance(double distance) {
		this.distance = distance;
	}
	
}
